# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=nemu
pkgver=3.3.1
pkgrel=0
pkgdesc="Ncurses UI for QEMU"
url="https://github.com/nemuTUI/nemu"
arch="all"
license="BSD-2-Clause"
depends="
	qemu
	qemu-img
	qemu-ui-spice-core
	qemu-hw-display-qxl
	"
makedepends="
	cmake
	dbus-dev
	eudev-dev
	gettext-dev
	graphviz-dev
	json-c-dev
	libarchive-dev
	libintl
	libusb-dev
	libxml2-dev
	ncurses-dev
	openssl-dev
	samurai
	sqlite-dev
	"
subpackages="
	$pkgname-doc
	$pkgname-lang
	$pkgname-bash-completion
	$pkgname-zsh-completion
	"
source="https://github.com/nemuTUI/nemu/archive/v$pkgver/nemu-$pkgver.tar.gz
	nemu.conf
	"
install="$pkgname.post-install"

build() {
	CFLAGS="$CFLAGS -D_GNU_SOURCE" \
	cmake -B builddir -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release \
		-DNM_WITH_NETWORK_MAP=ON \
		-DNM_WITH_DBUS=ON \
		-DNM_WITH_REMOTE=ON
	cmake --build builddir
}

check() {
	./builddir/nemu --version
}

package() {
	DESTDIR="$pkgdir" cmake --install builddir
	install -Dm644 "$srcdir"/nemu.conf -t "$pkgdir"/etc/modules-load.d
}

sha512sums="
2160b3af3f2c1abf5f517838be41460c49924b3ec6f25d475ed71711d314a5b6ef8fdb41e9e051bcdd397b0326e5074bacfc18bb9a51de6cd0d68ccc683206d8  nemu-3.3.1.tar.gz
871b650ff982be061532b4c5fe4812f41e6e2c58fc69b24f8a745f9a43389da44e742a69b0467b3c3d9e2b031af0728e20f10fa4584695c4f5ac87768a1fd34e  nemu.conf
"
